package per.com.controller.backend;

import com.github.pagehelper.PageInfo;
import com.sun.corba.se.impl.logging.POASystemException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import per.com.bean.Report;
import per.com.common.ServerResponse;
import per.com.service.IReportService;
import per.com.vo.ReportDetailVo;

/**
 * @author zxy
 */
@Controller
@ResponseBody
@RequestMapping(value = "/backend/report")
public class ReportManageController {

    @Autowired
    private IReportService iReportService;


    /**
     * 管理员根据举报用户 ID 查询到其所有的举报信息
     * @param userId
     * @param pageNum
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/find_one_report" , method = RequestMethod.POST)
    public ServerResponse<PageInfo> findOneReport(String userId , @RequestParam(value = "pageNum" , defaultValue = "1") int pageNum ,
                                                  @RequestParam(value = "pageSize" , defaultValue = "10") int pageSize){
        return iReportService.findOneReport(userId , pageNum , pageSize);
    }

    /**
     * 管理员查询到整个系统中所有的举报信息
     * @param pageNum
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/find_all_report" , method = RequestMethod.POST)
    public ServerResponse<PageInfo> findAllReport(@RequestParam(value = "pageNum" , defaultValue = "1") int pageNum ,
                                                  @RequestParam(value = "pageSize" , defaultValue = "10") int pageSize){

        return iReportService.findAllReport(pageNum , pageSize);
    }

    /**
     * 管理员根据被举报用户 ID 查询到其所有被举报的信息
     * @param reportedId
     * @param pageNum
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/find_one_reported" , method = RequestMethod.POST)
    public ServerResponse<PageInfo> findOneReported(String reportedId , @RequestParam(value = "pageNum" , defaultValue = "1") int pageNum ,
                                                    @RequestParam(value = "pageSize" , defaultValue = "10") int pageSize){

        return iReportService.findOneReported(reportedId , pageNum , pageSize);
    }

    /**
     * 管理员获取到举报信息详情
     * @param id
     * @return
     */
    @RequestMapping(value = "/find_report_detail" , method = RequestMethod.POST)
    public ServerResponse<ReportDetailVo> findReportDetail(String id){

        return iReportService.findReportDetail(id);
    }
}
